Query to get record details by using input ID